<script>
    var school={
        name:"NFIT",
        students:["张三","李四","王五"],
        [Symbol.iterator](){  //实现Symbol.iterator接口，获得可以for...of的功能
            let i=0;
            let that=this;
            return {
                next(){
                    if(i<that.students.length){  //如果没有到数组末尾
                        return {value: that.students[i++], done: false};  //取值并报告状态
                    }else{
                        return {value:undefined,done:true};
                    }
                }
            }
        }
    };
    for(let s of school){
        console.log(s);
    }
</script>